from idlelib.debugobj import dispatch

from fastapi import FastAPI
from starlette.middleware.base import BaseHTTPMiddleware

from middlewares import dbs
from routers import students

app = FastAPI()

# 添加路由
app.include_router(students.router)

# 添加中间件
app.add_middleware(BaseHTTPMiddleware,dispatch=dbs.create_session_middleware)

@app.get("/")
async def root():
    return {"message": "Hello fastapi"}

@app.get("/hello/{name}")
async def say_hello(name: str):
    return {"message": f"Hello {name}"}

